package com.crawler.crawler.tool.zyu.pipeline;

import com.crawler.crawler.domain.Book;
import us.codecraft.webmagic.ResultItems;
import us.codecraft.webmagic.Task;
import us.codecraft.webmagic.pipeline.Pipeline;

/**
 * 返回数据工具
 */
public class BookPipeline implements Pipeline {

    //返回的数据
    Book book;
    /**
     * Process extracted results.
     *
     * @param resultItems resultItems
     * @param task        task
     */
    @Override
    public void process(ResultItems resultItems, Task task) {
        book=resultItems.get("book");

    }

    /**
     * 返回数据
     * @return
     */
    public Book getBook(){
        return  book;
    }
}
